package com.ruoyi.zsyh.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.zsyh.mapper.ZsyhUserRepairareaMapper;
import com.ruoyi.zsyh.domain.ZsyhUserRepairarea;
import com.ruoyi.zsyh.service.IZsyhUserRepairareaService;
import com.ruoyi.common.core.text.Convert;

/**
 * 维修店服务区域Service业务层处理
 * 
 * @author yuexl
 * @date 2021-12-21
 */
@Service
public class ZsyhUserRepairareaServiceImpl implements IZsyhUserRepairareaService 
{
    @Autowired
    private ZsyhUserRepairareaMapper zsyhUserRepairareaMapper;

    /**
     * 查询维修店服务区域
     * 
     * @param id 维修店服务区域ID
     * @return 维修店服务区域
     */
    @Override
    public ZsyhUserRepairarea selectZsyhUserRepairareaById(String id)
    {
        return zsyhUserRepairareaMapper.selectZsyhUserRepairareaById(id);
    }

    /**
     * 查询维修店服务区域列表
     * 
     * @param zsyhUserRepairarea 维修店服务区域
     * @return 维修店服务区域
     */
    @Override
    public List<ZsyhUserRepairarea> selectZsyhUserRepairareaList(ZsyhUserRepairarea zsyhUserRepairarea)
    {
        return zsyhUserRepairareaMapper.selectZsyhUserRepairareaList(zsyhUserRepairarea);
    }

    public List<ZsyhUserRepairarea> selectZsyhUserRepairareaListByRakerId(String rakerId){
        return zsyhUserRepairareaMapper.selectZsyhUserRepairareaListByRakerId(rakerId);
    }

    /**
     * 新增维修店服务区域
     * 
     * @param zsyhUserRepairarea 维修店服务区域
     * @return 结果
     */
    @Override
    public int insertZsyhUserRepairarea(ZsyhUserRepairarea zsyhUserRepairarea)
    {
        zsyhUserRepairarea.setCreateTime(DateUtils.getNowDate());
        return zsyhUserRepairareaMapper.insertZsyhUserRepairarea(zsyhUserRepairarea);
    }

    /**
     * 修改维修店服务区域
     * 
     * @param zsyhUserRepairarea 维修店服务区域
     * @return 结果
     */
    @Override
    public int updateZsyhUserRepairarea(ZsyhUserRepairarea zsyhUserRepairarea)
    {
        zsyhUserRepairarea.setUpdateTime(DateUtils.getNowDate());
        return zsyhUserRepairareaMapper.updateZsyhUserRepairarea(zsyhUserRepairarea);
    }

    /**
     * 删除维修店服务区域对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteZsyhUserRepairareaByIds(String ids)
    {
        return zsyhUserRepairareaMapper.deleteZsyhUserRepairareaByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除维修店服务区域信息
     * 
     * @param id 维修店服务区域ID
     * @return 结果
     */
    @Override
    public int deleteZsyhUserRepairareaById(String id)
    {
        return zsyhUserRepairareaMapper.deleteZsyhUserRepairareaById(id);
    }

    public int deleteZsyhUserRepairareaByRepairId(String id){
        return zsyhUserRepairareaMapper.deleteZsyhUserRepairareaByRepairId(id);
    }

    public Integer insertZsyhUserRepairareaBatch(List<ZsyhUserRepairarea> list){
        return zsyhUserRepairareaMapper.insertZsyhUserRepairareaBatch(list);
    }

    public List<Map> getRakerAreaListProvince(String repairId){
        return zsyhUserRepairareaMapper.getRakerAreaListProvince(repairId);
    }

    public List<Map> getRakerAreaListCity(String repairId,String pId){
        return zsyhUserRepairareaMapper.getRakerAreaListCity(repairId, pId);
    }

    public List<Map> getRakerAreaListArea(String repairId, String pId){
        return zsyhUserRepairareaMapper.getRakerAreaListArea(repairId, pId);
    }

    public List<ZsyhUserRepairarea> selectAreaByAgentId(String agentId){
        return zsyhUserRepairareaMapper.selectAreaByAgentId(agentId);
    }

    public ZsyhUserRepairarea selectAgentIdByAreaId(String areaId){
        return zsyhUserRepairareaMapper.selectAgentIdByAreaId(areaId);
    }

}
